@menu-prefix-cls: ~"@{css-prefix}menu";
@menu-dropdown-item-prefix-cls: ~"@{menu-prefix-cls}-horizontal .@{menu-prefix-cls}-submenu .@{select-dropdown-prefix-cls} .@{menu-prefix-cls}-item";
@transfer-no-max-height: ~"@{css-prefix}transfer-no-max-height";

.@{menu-prefix-cls} {
  display: block;
  margin: 0;
  padding: 0;
  outline: none;
  list-style: none;
  color: @color-text-level1;
  font-size: @font-size-base;
  position: relative;
  z-index: @zindex-menu;
  transition: all @transition-time @ease-in-out;

  &-horizontal {
    height: 60px;
    line-height: 60px;

    // &::after {
    //   content:'';
    //   width: 0px;
    //   height: 0px;
    //   border: 40px solid;
    //   border-color: transparent transparent transparent #999999;
    // }
    &.@{menu-prefix-cls}-light {
      &:after {
        content: '';
        display: block;
        width: 100%;
        height: 1px;
        background: @border-color-base;
        position: absolute;
        bottom: 0;
        left: 0;
      }
    }
  }

  &-scalable {
    &.@{menu-prefix-cls}-light {
      &:after {
        content: '';
        display: block;
        width: 1px;
        height: 100%;
        background: @border-color-base;
        position: absolute;
        top: 0;
        bottom: 0;
        right: 0;
        z-index: 1;
      }
    }
  }

  &-vertical {
    // box-shadow: 0px 2px 10px 0px rgba(153, 153, 153, 0.5);
    &.@{menu-prefix-cls}-light {
      &:after {
        // content: '';
        // display: block;
        // width: 1px;
        // height: 100%;
        // background: @border-color-base;
        // position: absolute;
        // top: 0;
        // bottom: 0;
        // right: 0;
        // z-index: 1;
      }
    }
    &.@{menu-prefix-cls}-collapse {
      .@{menu-prefix-cls}-item {
        width: 50px;
        overflow: hidden;
        white-space: nowrap;
      }
    }

  }

  &-light {
    background: @color-bg-menu;
  }

  &-primary {
    background: @primary-color;
  }

  &-dark {
    background: #191a23;
  }

  &-dark&-horizontal &-item,
  &-dark&-horizontal &-submenu {
    color: rgba(255, 255, 255, .7);

    &-active,
    &:hover {
      color: #fff;
    }
  }

  &-dark&-vertical &-item-group {
    &-title {
      color: rgba(255, 255, 255, .36);
    }
  }

  &-dark&-vertical &-item,
  &-dark&-vertical &-submenu-title {
    color: rgba(255, 255, 255, .7);

    &-active:not(.@{menu-prefix-cls}-submenu),
    &-active:not(.@{menu-prefix-cls}-submenu):hover {
      background: #363e4f;
    }

    &:hover {
      color: #fff;
      background: #191a23;
    }

    &-active:not(.@{menu-prefix-cls}-submenu) {
      color: @primary-color;
      //border-right: 2px solid @primary-color;
    }
  }

  &-dark&-vertical &-submenu &-item {
    &:hover {
      color: #fff;
      background: transparent !important;
    }

    &-active,
    &-active:hover {
      border-right: none;
      color: #fff;
      background: @primary-color !important;
    }
  }

  // &-dark&-vertical &-item-active &-submenu-title{
  //     color: #fff;
  // }
  &-dark&-vertical &-child-item-active>&-submenu-title {
    color: #fff;
  }

  &-dark&-vertical &-opened {
    background: #101117;

    .@{menu-prefix-cls}-submenu-title {
      background: #191a23;
    }

    .@{menu-prefix-cls}-submenu-has-parent-submenu {
      .@{menu-prefix-cls}-submenu-title {
        background: transparent;
      }
    }
  }

  &-item {
    display: block;
    outline: none;
    list-style: none;
    font-size: @font-size-base;
    font-weight: 400;
    color: @color-text-level1;
    position: relative;
    z-index: 1;
    cursor: pointer;
    transition: all @transition-time @ease-in-out;
  }

  a&-item {
    color: inherit;

    &:hover,
    &:active {
      color: inherit;
    }
  }

  &-item > i {
    margin-right: 6px;
  }

  &-submenu-title > i,
  &-submenu-title span > i {
    margin-right: 8px;
  }

  &-horizontal &-item,
  &-horizontal &-submenu {
    float: left;
    padding: 0 20px;
    position: relative;
    cursor: pointer;
    z-index: 3;
    transition: all @transition-time @ease-in-out;
  }

  &-light&-horizontal &-item,
  &-light&-horizontal &-submenu {
    height: inherit;
    line-height: inherit;
    border-bottom: 2px solid transparent;
    color: @text-color;

    &-active,
    &:hover {
      color: @primary-color;
      border-bottom: 2px solid @primary-color;
    }
  }

  &-primary&-horizontal &-item,
  &-primary&-horizontal &-submenu {
    color: @color-functional-white;

    &-active,
    &:hover {
      // background: @link-active-color;
    }
  }

  &-horizontal &-submenu .@{select-dropdown-prefix-cls} {
    min-width: 100%;
    width: auto;
    max-height: none;

    .@{menu-prefix-cls}-item {
      height: auto;
      line-height: normal;
      border-bottom: 0;
      float: none;
    }
  }

  &-item-group {
    line-height: normal;
    list-style: none;

    &-title {
      height: 30px;
      line-height: 30px;
      padding-left: 8px;
      font-size: @font-size-small;
      color: @color-text-level1;
    }

    &>ul {
      padding: 0 !important;
      list-style: none !important;
    }
  }

  // vertical
  &-vertical &-item,
  &-vertical &-submenu-title {
    padding: 12px 30px 12px 20px;
    position: relative;
    cursor: pointer;
    z-index: 1;
    transition: all @transition-time @ease-in-out;
    word-wrap: break-word;
    height: 40px;

    &:hover {
      background: rgba(232, 240, 255, 0.4);
    }
  }

  &-vertical &-submenu-title {
    &:hover {
      color: @primary-color;
      background: rgba(232, 240, 255, 0.4);
    }
  }

  &-vertical &-submenu-title-icon {
    // #5592 支持自定义图标 size 后，换一种位置
    //float: right;
    //position: relative;
    //top: 4px;
    position: absolute;
    top: 50%;
    right: 24px;
    transform: translateY(-50%);
  }

  &-submenu-title-icon {
    transition: transform @transition-time @ease-in-out;
  }

  &-horizontal &-opened>*>&-submenu-title-icon {
    transform: rotate(180deg);
    // transform: rotate(90deg);
  }

  &-vertical &-opened>*>&-submenu-title-icon {
    transform: translateY(-50%) rotate(180deg);
  }

  &-vertical &-submenu {
    &-nested {
      padding-left: 20px;
    }

    .@{menu-prefix-cls}-item {
      // padding-left: 43px;
      padding-left: 30px;
    }
  }

  &-vertical &-item-group {
    &-title {
      height: 48px;
      line-height: 48px;
      font-size: @font-size-base;
      padding-left: 28px;
    }
  }

  &-light&-vertical &-item {

    //border-right: 2px solid transparent;
    &-active:not(.@{menu-prefix-cls}-submenu) {
      color: @color-text-menu;
      background:~`colorPalette("@{primary-color}", 1)`;
      // border-right: 2px solid @primary-color;
      background: @color-bg-select;
      z-index: 2;

      &:after {
        content: '';
        display: block;
        width: 3px;
        position: absolute;
        top: 0;
        bottom: 0;
        // right: 0;
        left: 0;
        background: @primary-color;
      }
    }
  }
}

.select-item(@menu-prefix-cls, @menu-dropdown-item-prefix-cls);

.@{menu-dropdown-item-prefix-cls} {
  padding: 7px 16px 8px;
  font-size: @font-size-base !important;
}

.@{menu-prefix-cls}-horizontal {
  .@{menu-prefix-cls}-submenu-has-parent-submenu {

    //   &-opened &-submenu-title-icon{
    //     transform: rotate(90deg);
    // }
    padding: 0 16px;
    padding: 7px 16px 8px;
    height: 16px;
    margin: 0;

    .@{menu-prefix-cls}-submenu-title {
      height: 100%;
      line-height: 100%;
      position: relative;

      .@{menu-prefix-cls}-submenu-title-icon {
        position: absolute;
        right: 0;
      }

      // padding: 7px 16px 8px;
    }

    &:hover {
      .haloe-icon-chevron-down {
        transform: rotate(90deg);
      }
    }

    .haloe-icon-chevron-down {
      transform: rotate(270deg);
    }

    width: 100%;
    list-style: none;

    .@{menu-prefix-cls}-submenu-title {
      width: 100%;
    }
  }

  .@{menu-prefix-cls}-submenu .@{css-prefix}select-dropdown {
    overflow: visible;

    &-transfer {
      z-index: @zindex-transfer;
      width: auto;
    }

    &.@{transfer-no-max-height} {
      max-height: none;
    }
  }
}

.right-hand-icon {
  transform: rotate(180deg)
}

.@{menu-prefix-cls}-outer {
  position: relative;
  box-shadow: 0px 2px 10px 0px rgba(153, 153, 153, 0.5);
}

.@{menu-prefix-cls}-header {
  height: 60px;
  line-height: 60px;
  padding-left: 20px;
  font-size: @font-size-middle;
  color: @color-text-level2;
}

.@{menu-prefix-cls}-trigger {
  position: absolute;
  text-align: center;
  width: 10px;
  right: -10px;
  top: 50%;
  transform: translateY(calc(-48px / 2));
  cursor: pointer;
  height: 60px;
  line-height: 60px;
  background-color: @color-functional-white;
  z-index: 1000;
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
  transition: width 0.2s ease-in-out;
  box-shadow: 0px 2px 10px 0px rgba(153, 153, 153, 0.5);
}

.@{menu-prefix-cls}-trigger-collapsed{
  transition: width 10s ease-in-out;
}

.@{menu-prefix-cls}-trigger-collapsed .@{menu-prefix-cls}-trigger-icon {
  transform: rotateZ(180deg) translate(calc(-2px));
}

.@{menu-prefix-cls}-trigger .@{menu-prefix-cls}-icon {
  transform-origin: center center;
  transform: translateX(calc(-2px));
  width: 0;
  height: 0;
  display: inline-block;
  border: calc(4px) solid #515a6e;
  border: calc(4px) solid #555555;
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-left-color: transparent;
}

.@{menu-prefix-cls}-trigger-collapsed .@{menu-prefix-cls}-trigger-icon {
  -webkit-transform: rotateZ(180deg) translate(calc(-8px / 4));
  -ms-transform: rotate(180deg) translate(calc(-8px / 4));
  transform: rotateZ(180deg) translate(calc(-8px / 4));
}

.haloe-menu-collapse {
  // display: none;
}